package com.evoupsight.monitorpass.perfs;

import java.util.Map;
import java.util.Random;
import java.util.TreeMap;

public class AntlrPerf {
    public static void main(String[] args) {

        String boolExpr = "1 && 2 || 3 || 4 && (5 || 6)";

        int iterNums = 1000000;
        long randomSeed = 10001L;
        Random random = new Random(randomSeed);

        Long beg = System.currentTimeMillis();
        for ( int i = 0; i<=iterNums; i++ ) {
            Map<String, Boolean> params = new TreeMap<>();
            params.put("1", random.nextBoolean());
            params.put("2", random.nextBoolean());
            params.put("3", random.nextBoolean());
            params.put("4", random.nextBoolean());
            params.put("5", random.nextBoolean());
            params.put("6", random.nextBoolean());
            ExprEvalutorHelper.exec(boolExpr, params);
        }
        long end = System.currentTimeMillis();
        System.out.println(String.format("total consume: %dms", end - beg));

    }
}
